﻿<UserControl x:Class="HighLandirect.Presentation.Views.ProductView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:p="clr-namespace:HighLandirect.Presentation.Properties"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c="clr-namespace:HighLandirect.Presentation.Converters"
    xmlns:vm="clr-namespace:HighLandirect.Applications.ViewModels;assembly=HighLandirect.Applications"
    mc:Ignorable="d" d:DataContext="{d:DesignInstance vm:ProductViewModel}"
    MinWidth="250" MinHeight="270" IsEnabled="{Binding IsEnabled}">
    <Grid>
        <Grid.Resources>
            <c:NumberFormatter x:Key="myNumberFormatter"/>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Label Content="{x:Static p:Resources.ProductName}" Grid.Column="0" Grid.Row="0" FontSize="16" />
        <TextBox Text="{Binding Product.ProductName, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=true, 
                     ValidatesOnDataErrors=true, NotifyOnValidationError=true}"
                 MaxLength="100" Grid.Column="1" HorizontalAlignment="Stretch" FontSize="16" />

        <Label Content="{x:Static p:Resources.Tanka}" Grid.Column="0" Grid.Row="1" FontSize="16" />
        <TextBox Text="{Binding Product.Tanka, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=true, 
                     ValidatesOnDataErrors=true, NotifyOnValidationError=true, Converter={StaticResource myNumberFormatter},ConverterParameter='#,##0'}"
                 MaxLength="10" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" FontSize="16" FontFamily="MS Gothic" />

    </Grid>
</UserControl>
